import jsc from 'jsverify'
import React from 'react'
import configStore from 'redux-mock-store'
import ConnectedCounter, {Counter} from '../src/counter'

describe('Counter', () => {
  const createStore = configStore()
  const wrapper = store => mount(<ConnectedCounter store={store}/>)
  it('Displays count from redux', () =>
     jsc.checkForall(jsc.nat, count =>
       expect(wrapper(createStore({count})).find(Counter).prop('count'))
         .equal(count))),
  it('Calls increment action when clicked', () => {
    const store = createStore({count: 0})
    wrapper(store).find(Counter).find('button').simulate('click')
    expect(store.getActions()[0].type)
      .equal("INCREMENT")
  })
})
